#ifndef COLLECTION_H
#define COLLECTION_H

namespace Library
{

template<class O> class Iterator;

template<class O>
class Collection
{
	public:
						Collection();
		virtual			~Collection();

		/**
		 * @param object		Object to add.
		 * @return				true on success.  false on error.
		 *
		 * Adds an object to this collection.
		 */
		virtual bool8	add(O object) = 0;

		/**
		 * @param collection	A pointer to a collection.
		 * @return				true if all items added.  false if not.
		 *
		 * Adds all of the objects in the specified collection to this
		 * collection.
		 */
		virtual bool8	addAll(Collection<O> * collection) = 0;

		/**
		 * Clears the data structures required to store objects in this
		 * collection, but does not delete the objects.  If object deletion
		 * is required, use vaporize.
		 */
		virtual void	clear() = 0;

		/**
		 * @param object		Object to check.
		 * @return				true if object is in collection.  false if not.
		 *
		 * Checks to see if the object is in this collection.
		 */
		virtual bool8	contains(O object) = 0;

		/**
		 * @param collection	A pointer to a collection.
		 * @return				true if all present.  false otherwise.
		 *
		 * Checks to see if this collection contains all objects in the
		 * specified collection.
		 */
		virtual bool8	containsAll(Collection<O> * collection) = 0;

		/**
		 * @return				true if collection is empty.  false otherwise.
		 *
		 * Determines of collection is empty (void of all objects).
		 */
		virtual bool8	isEmpty() = 0;

		/**
		 * @param object		Object to remove.
		 * @return				true if removed.  false if not.
		 *
		 * Removes an object from this collection.
		 */
		virtual bool8	remove(O object) = 0;

		/**
		 * @param collection	A pointer to a collection.
		 * @return				true if all removed.  false otherwise.
		 *
		 * Removes all objects in specified collection from this collection.
		 */
		virtual bool8	removeAll(Collection<O> * collection) = 0;

//		virtual bool8	retainAll(Collection<O> * collection) = 0;

		/**
		 * @return				The number of objects in this collection.
		 *
		 * Returns the number of objects in this collection.
		 */
		virtual uint32	size() = 0;

		/**
		 * Clears the data structures required to store objects in this
		 * collection and deletes the objects.  If object deletion is not
		 * required, use clear.
		 */
		virtual void	vaporize() = 0;


		virtual Iterator<O> * iterator() = 0;

	// prohibited
	private:
		Collection(Collection<O> &);
		Collection & operator=(Collection<O> &);
};


template<class O>
class Iterator
{
	public:
						Iterator();
		virtual			~Iterator();

		virtual	void	begin() = 0;
		virtual bool8	hasNext() = 0;
		virtual O		next() = 0;
		virtual bool8	remove() = 0;

	// prohibited
	private:
		Iterator(Iterator<O> &);
		Iterator & operator=(Iterator<O> &);
};


//============================================================================

template<class O>
Collection<O>::Collection()
{
}

template<class O>
Collection<O>::~Collection()
{
}

//============================================================================

template<class O>
Iterator<O>::Iterator()
{
}

template<class O>
Iterator<O>::~Iterator()
{
}

}; // namespace Library

#endif
